package com.huawei123.hasee.cniao5store.mvp.presenter.impl;

import com.huawei123.hasee.cniao5store.api.IGetDataDelegate;
import com.huawei123.hasee.cniao5store.base.BaseActivity;
import com.huawei123.hasee.cniao5store.base.mvp_base.MvpPresenterImpl;
import com.huawei123.hasee.cniao5store.bean.TopBean;
import com.huawei123.hasee.cniao5store.mvp.interactor.TopInteractor;
import com.huawei123.hasee.cniao5store.mvp.presenter.TopFragmentPresenter;
import com.huawei123.hasee.cniao5store.mvp.view.view.TopFragmentView;

import javax.inject.Inject;

/**
 * 项目名称：Cniao5Store
 * 类描述：排行页加载
 * 创建人：luohao
 * 创建时间：2018/1/31 15:36
 * 修改人：luohao
 * 修改时间：2018/1/31 15:36
 * 修改备注：
 */

public class TopPresenterImpl extends MvpPresenterImpl<TopFragmentView> implements TopFragmentPresenter {
    @Inject
    public TopInteractor topInteractor;

    @Inject
    public TopPresenterImpl() {

    }
    /**
     * 写入网络请求等数据来源处理
     */
    @Override
    public void getTopData(BaseActivity activity) {
        topInteractor.loadTopData(activity, new IGetDataDelegate<TopBean>() {
            @Override
            public void getDataSuccess(TopBean topBean) {
                myPresenterView.requestDataSuccess(topBean);
            }

            @Override
            public void getDataError(String errmsg) {
                myPresenterView.requestDataError(errmsg);
            }
        });
    }
}
